package cn.harry.modular.sys.domain;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * 后台用户登录日志表
 *
 * @author honghh Date 2019-10-14 10:39:25 Copyright (C) www.tech-harry.cn
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_user_login_log")
public class SysUserLoginLog implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 *
	 */
	@TableId
	private Long id;

	@Schema(description = "token")
	private String token;

	/**
	 * 用户ID
	 */
	private Long userId;

	/**
	 * 用户名
	 */
	@Schema(description = "用户名")
	@TableField(condition = SqlCondition.LIKE)
	private String username;

	/**
	 * 用户昵称
	 */
	@Schema(description = "用户昵称")
	private String nickName;

	/**
	 * 登陆IP
	 */
	@Schema(description = "登陆IP")
	private String ip;

	/**
	 * 登陆地点
	 */
	@Schema(description = "登陆地点")
	@TableField(condition = SqlCondition.LIKE)
	private String address;

	/**
	 * 浏览器登录类型
	 */
	@Schema(description = "浏览器")
	private String browser;

	/**
	 * 操作系统
	 */
	private String os;

	/**
	 * 过期时间
	 */
	@Schema(description = "过期时间")
	@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
	private Date expTime;

	/**
	 * 创建时间
	 */
	@Schema(description = "创建时间")
	@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
	private Date createTime;

	/**
	 * 修改时间
	 */
	@Schema(description = "修改时间")
	@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
	private Date modifyTime;

	/**
	 * 有效状态：0->无效；1->有效
	 */
	@Schema(description = "有效状态：0->无效；1->有效")
	@TableLogic
	private Integer valid;

	/** 开始时间 */
	@JsonIgnore
	@TableField(exist = false)
	private String beginTime;

	/** 结束时间 */
	@JsonIgnore
	@TableField(exist = false)
	private String endTime;

}
